<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>org.apache.commons.collections4.sequence (Apache Commons Collections 4.0 API)</title>
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
    if (location.href.indexOf('is-external=true') == -1) {
        parent.document.title="org.apache.commons.collections4.sequence (Apache Commons Collections 4.0 API)";
    }
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!--   -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li class="navBarCell1Rev">Package</li>
<li>Class</li>
<li><a href="package-use.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../org/apache/commons/collections4/queue/package-summary.html">Prev Package</a></li>
<li><a href="../../../../../org/apache/commons/collections4/set/package-summary.html">Next Package</a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/commons/collections4/sequence/package-summary.html" target="_top">Frames</a></li>
<li><a href="package-summary.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
  allClassesLink = document.getElementById("allclasses_navbar_top");
  if(window==top) {
    allClassesLink.style.display = "block";
  }
  else {
    allClassesLink.style.display = "none";
  }
  //-->
</script>
</div>
<a name="skip-navbar_top">
<!--   -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h1 title="Package" class="title">Package&nbsp;org.apache.commons.collections4.sequence</h1>
<div class="docSummary">
<div class="block">This package provides classes to compare two sequences of objects.</div>
</div>
<p>See:&nbsp;<a href="#package_description">Description</a></p>
</div>
<div class="contentContainer">
<ul class="blockList">
<li class="blockList">
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Interface Summary table, listing interfaces, and an explanation">
<caption><span>Interface Summary</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Interface</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../org/apache/commons/collections4/sequence/CommandVisitor.html" title="interface in org.apache.commons.collections4.sequence">CommandVisitor</a>&lt;T&gt;</td>
<td class="colLast">
<div class="block">This interface should be implemented by user object to walk
 through <a href="../../../../../org/apache/commons/collections4/sequence/EditScript.html" title="class in org.apache.commons.collections4.sequence"><code>EditScript</code></a> objects.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../../org/apache/commons/collections4/sequence/ReplacementsHandler.html" title="interface in org.apache.commons.collections4.sequence">ReplacementsHandler</a>&lt;T&gt;</td>
<td class="colLast">
<div class="block">This interface is devoted to handle synchronized replacement sequences.</div>
</td>
</tr>
</tbody>
</table>
</li>
<li class="blockList">
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Class Summary table, listing classes, and an explanation">
<caption><span>Class Summary</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Class</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../org/apache/commons/collections4/sequence/DeleteCommand.html" title="class in org.apache.commons.collections4.sequence">DeleteCommand</a>&lt;T&gt;</td>
<td class="colLast">
<div class="block">Command representing the deletion of one object of the first sequence.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../../org/apache/commons/collections4/sequence/EditCommand.html" title="class in org.apache.commons.collections4.sequence">EditCommand</a>&lt;T&gt;</td>
<td class="colLast">
<div class="block">Abstract base class for all commands used to transform an objects sequence
 into another one.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../org/apache/commons/collections4/sequence/EditScript.html" title="class in org.apache.commons.collections4.sequence">EditScript</a>&lt;T&gt;</td>
<td class="colLast">
<div class="block">This class gathers all the <a href="../../../../../org/apache/commons/collections4/sequence/EditCommand.html" title="class in org.apache.commons.collections4.sequence"><code>commands</code></a> needed to transform
 one objects sequence into another objects sequence.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../../org/apache/commons/collections4/sequence/InsertCommand.html" title="class in org.apache.commons.collections4.sequence">InsertCommand</a>&lt;T&gt;</td>
<td class="colLast">
<div class="block">Command representing the insertion of one object of the second sequence.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../org/apache/commons/collections4/sequence/KeepCommand.html" title="class in org.apache.commons.collections4.sequence">KeepCommand</a>&lt;T&gt;</td>
<td class="colLast">
<div class="block">Command representing the keeping of one object present in both sequences.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../../org/apache/commons/collections4/sequence/ReplacementsFinder.html" title="class in org.apache.commons.collections4.sequence">ReplacementsFinder</a>&lt;T&gt;</td>
<td class="colLast">
<div class="block">This class handles sequences of replacements resulting from a comparison.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../org/apache/commons/collections4/sequence/SequencesComparator.html" title="class in org.apache.commons.collections4.sequence">SequencesComparator</a>&lt;T&gt;</td>
<td class="colLast">
<div class="block">This class allows to compare two objects sequences.</div>
</td>
</tr>
</tbody>
</table>
</li>
</ul>
<a name="package_description">
<!--   -->
</a>
<h2 title="Package org.apache.commons.collections4.sequence Description">Package org.apache.commons.collections4.sequence Description</h2>
<div class="block">This package provides classes to compare two sequences of objects.
 <p>
 The two sequences can hold any object type, as only the
 <code>equals</code> method is used to compare the elements of the
 sequences. It is guaranteed that the comparisons will always be done
 as <code>o1.equals(o2)</code> where <code>o1</code> belongs to the
 first sequence and <code>o2</code> belongs to the second
 sequence. This can be important if subclassing is used for some
 elements in the first sequence and the <code>equals</code> method is
 specialized.
 <p>
 Comparison can be seen from two points of view: either as giving the
 smallest modification allowing to transform the first sequence into
 the second one, or as giving the longest sequence which is a
 subsequence of both initial sequences. The <code>equals</code> method
 is used to compare objects, so any object can be put into
 sequences. Modifications include deleting, inserting or keeping one
 object, starting from the beginning of the first sequence. Like most
 algorithms of the same type, objects transpositions are not
 supported. This means that if a sequence <code>(A, B)</code> is
 compared to <code>(B, A)</code>, the result will be either the
 sequence of three commands <code>delete A</code>, <code>keep B</code>,
 <code>insert A</code> or the sequence  <code>insert B</code>,
 <code>keep A</code>, <code>delete B</code>.
 <p>
 The package uses a very efficient comparison algorithm designed by
 Eugene W. Myers and described in his paper: <a
 href="http://www.cis.upenn.edu/~bcpierce/courses/dd/papers/diff.ps">An O(ND)
 Difference Algorithm and Its Variations</a>. This algorithm produces
 the shortest possible
 <a href="../../../../../org/apache/commons/collections4/sequence/EditScript.html" title="class in org.apache.commons.collections4.sequence"><code>edit script</code></a> containing
 all the <a href="../../../../../org/apache/commons/collections4/sequence/EditCommand.html" title="class in org.apache.commons.collections4.sequence"><code>commands</code></a>
 needed to transform the first sequence into the second one.
 The entry point for the user to this algorithm is the
 <a href="../../../../../org/apache/commons/collections4/sequence/SequencesComparator.html" title="class in org.apache.commons.collections4.sequence"><code>SequencesComparator</code></a> class.
 <p>
 As explained in Gene Myers paper, the edit script is equivalent to all
 other representations and contains all the needed information either
 to perform the transformation, of course, or to retrieve the longest
 common subsequence for example.
 <p>
 If the user needs a very fine grained access to the comparison result,
 he needs to go through this script by providing a visitor implementing
 the <a href="../../../../../org/apache/commons/collections4/sequence/CommandVisitor.html" title="interface in org.apache.commons.collections4.sequence"><code>CommandVisitor</code></a> interface.
 <p>
 Sometimes however, a more synthetic approach is needed. If the user
 prefers to see the differences between the two sequences as global
 <code>replacement</code> operations acting on complete subsequences of
 the original sequences, he will provide an object implementing the
 simple <a href="../../../../../org/apache/commons/collections4/sequence/ReplacementsHandler.html" title="interface in org.apache.commons.collections4.sequence"><code>ReplacementsHandler</code></a> interface,
 using an instance of the <a href="../../../../../org/apache/commons/collections4/sequence/ReplacementsFinder.html" title="class in org.apache.commons.collections4.sequence"><code>ReplacementsFinder</code></a>
 class as a command converting layer between his object and the edit script. The number of
 objects which are common to both initial arrays and hence are skipped between each call to the user
 <a href="../../../../../org/apache/commons/collections4/sequence/ReplacementsHandler.html#handleReplacement(int, java.util.List, java.util.List)"><code>handleReplacement</code></a>
 method is also provided. This allows the user to keep track of the current index in
 both arrays if he needs so.</div>
<dl><dt><span class="strong">Version:</span></dt>
  <dd>$Id: package-info.java 1479338 2013-05-05 15:21:44Z tn $</dd></dl>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!--   -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../overview-summary.html">Overview</a></li>
<li class="navBarCell1Rev">Package</li>
<li>Class</li>
<li><a href="package-use.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../org/apache/commons/collections4/queue/package-summary.html">Prev Package</a></li>
<li><a href="../../../../../org/apache/commons/collections4/set/package-summary.html">Next Package</a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../index.html?org/apache/commons/collections4/sequence/package-summary.html" target="_top">Frames</a></li>
<li><a href="package-summary.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
  allClassesLink = document.getElementById("allclasses_navbar_bottom");
  if(window==top) {
    allClassesLink.style.display = "block";
  }
  else {
    allClassesLink.style.display = "none";
  }
  //-->
</script>
</div>
<a name="skip-navbar_bottom">
<!--   -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright &#169; 2001&#x2013;2013 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</body>
</html>
